<?php
header("Content-Type:text/html; charset=utf-8");

class db_comment{
	public function commentcontent($sql){
		$commentnewscontent="";
    	require_once("connetMysql.class.php"); 
		$db=new connetMysql;
		$con=$db->getConnect();
		$result = mysqli_query($con,$sql);
		while($row = mysqli_fetch_array($result))
  		{
			/*
			$commentid=$row["commentID"];
			$sqlzan="SELECT * FROM commentopinion where commentID='$commentid' and commentopinion=1";
			$resultzan = mysqli_query($con,$sqlzan);
			$commentzannumber=mysqli_num_rows($resultzan);
			$sqljubao="SELECT * FROM commentopinion where commentID='$commentid' and commentopinion=2";
			$resultjubao = mysqli_query($con,$sqljubao);
			$commentjubaonumber=mysqli_num_rows($resultjubao);
			*/
  			$commentnewscontent = $commentnewscontent . "<div class='pinglun_content' id='pinglun_content'>
			<div class='pinglun_user_img'><img src='images/userpic.jpg' alt='' class='pinglun_user_img_style'></div>
			<div class='pinglun_content_right'><p class='pinglun_username_time'><span id='pinglun_username'>".$row["commentusername"]."</span><span id='fabu_pinglun_time'>".$row["commenttime"]."</span></p>
			<p class='pinglun_detail_content'>".$row["commentcontent"]."</p>
			<p class='pinglun_zan_jubao'><a href='javascript:void(0);' onclick='js_zan(".$row["commentID"].")' id='pinglun_zan_a_".$row["commentID"]."'><span id='pinglun_zan'>赞(<span id='comment_zan_number_".$row["commentID"]."'>".$row["commentpraisetimes"]."</span>)</span></a>
			<a href='javascript:void(0);' onclick='js_jubao(".$row["commentID"].")' id='pinglun_jubao_a_".$row["commentID"]."'><span id='pinglun_jubao'>举报（<span id='comment_jubao_number_".$row["commentID"]."'>".$row["commentreporttimes"]."</span>）</span></a></p></div><div style='clear:both;'></div></div>";
  		}
		
		return $commentnewscontent;
    }
	
	public function commentcontentnumber($sql){
		$commentnewscontent="";
    	require_once("connetMysql.class.php"); 
		$db=new connetMysql;
		$con=$db->getConnect();
		$result = mysqli_query($con,$sql);
		$newscommentnumber=mysqli_num_rows($result);
		return $newscommentnumber;
	}
}
?>